home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / electronic / rlab / TestMatrix / seqm_r < prev    next >
Encoding:
Text File  |  1994-12-20  |  849 b   |  36 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Multiplicative sequence.
  4.  
  5. // Syntax:    Y = seqm ( A , B , N )
  6.  
  7. // Description:
  8.  
  9. //    seqm(A,B,N)  produces a row vector comprising N
  10. //    logarithmically equally spaced numbers, starting at A ~= 0 and
  11. //    finishing at B ~= 0. If A*B < 0 and N > 2 then complex results
  12. //    are produced. If N is omitted then 10 points are generated.
  13.  
  14. //    This file is a translation of seqm.m from version 2.0 of
  15. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  16. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  17.  
  18. //-------------------------------------------------------------------//
  19.  
  20. seqm = function ( a , b , n )
  21. {
  22.   if (!exist (n)) { n = 10; }
  23.  
  24.   if (n <= 1)
  25.   {
  26.     y = a;
  27.     return y;
  28.   }
  29.  
  30.   p = [0:n-2]/(n-1);
  31.   r = (b/a).^p;
  32.   y = [a*r, b];
  33.  
  34.   return y;
  35. };
  36.